package com.hu.web.filter;

import javax.servlet.*;
import java.io.IOException;

public class TestFilter implements Filter {

    public TestFilter() {
        System.out.println("TestFilter 构造器执行");
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("TestFilter init 方法执行");
    }

    // 过滤器的核心过滤方法
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        // 放行
        filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void destroy() {
        System.out.println("TestFilter destroy 方法执行");
    }

}
